package cn.dm.controller;

import cn.dm.dto.Dto;
import cn.dm.service.LocalItemService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/api")
public class ItemController {
    @Resource
    private LocalItemService localItemService;
    @RequestMapping(value = "getItemInfo",method = RequestMethod.POST)
    public Dto getItemInfo(Long id) throws Exception{
        return localItemService.getItemInfo(Long.valueOf(id));
    }

    /**
     * 根据商品ItemId获得电影的排期
     * @param itemId
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getScheduler",method = RequestMethod.POST)
    public Dto getScheduler(String itemId) throws Exception{
        return localItemService.getScheduler(Long.valueOf(itemId));
    }

    @RequestMapping(value = "queryItemPrice",method = RequestMethod.POST)
    public Dto queryItemPrice(String id) throws Exception{
        return localItemService.queryItemPrice(Long.valueOf(id));
    }
}
